package com.doit.day06

/**
 * 一定是要将父类的构造方法一起继承过来
 * 用的关键字是 extends
 *
 * 特质：第一个用extends 后面都用with
 */
object _05_面相对象之继承 {
  def main(args: Array[String]): Unit = {
    val zi: Fu = new Zi("思聪",18,1)
    println(zi.name)//思聪
    println(zi.age)//18
    zi.fish()// 哼，我都是海钓
//    zi.playGames()//lol
    zi.makeMoney()//小目标
    zi.xiaQi()
  }
}


class Ye(val id:Int,val name:String){
  def xiaQi()={
    println("下棋")
  }
}

class Fu(override val name:String,val age:Int) extends Ye(1,name) {

  def makeMoney()={
    println("随随便便一个小目标啦")
  }

  def fish()={
    println("钓鱼钓鱼")
  }
}

class Zi(override val name:String, override val age:Int, override val id:Int) extends Fu("马爸爸",20){

  def playGames()={
    println("lol搞起来")
  }

  override def fish(): Unit = {
    println("哼，我都是海钓")
    }

}
